<?php
/**
 * Magento Enterprise Edition
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Magento Enterprise Edition End User License Agreement
 * that is bundled with this package in the file LICENSE_EE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://www.magento.com/license/enterprise-edition
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magento.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magento.com for more information.
 *
 * @category    design
 * @package     rwd_enterprise
 * @copyright Copyright (c) 2006-2015 X.commerce, Inc. (http://www.magento.com)
 * @license http://www.magento.com/license/enterprise-edition
 */
?>
<?php
/**
 * @see Enterprise_Reward_Block_Customer_Reward_History
 */
?>
<div class="box">
    <h2 class="sub-title"><?php echo $this->__('Balance History'); ?></h2>

    <?php if ($history = $this->getHistory()):?>

    <?php echo $this->getChildHtml('pager') ?>

    <table id="reward-history" class="data-table">
        <col width="1" />
        <col width="1" />
        <col width="1" />
        <col />
        <col width="1" />
        <thead>
            <tr>
                <th class="balance"><?php echo $this->__('Balance'); ?></th>
                <th class="amount"><?php echo $this->__('Amount'); ?></th>
                <th class="points"><?php echo $this->__('Points'); ?></th>
                <th class="reason"><?php echo $this->__('Reason'); ?></th>
                <th class="date"><?php echo $this->__('Date'); ?></th>
            </tr>
        </thead>
        <tbody>
            <?php foreach($history as $item): ?>
            <tr>
                <td class="a-right balance"><?php echo $this->getPointsBalance($item)?></td>
                <td class="a-right amount"><?php echo $this->getCurrencyBalance($item)?></td>
                <td class="a-right points"><?php echo $this->getPointsDelta($item)?></td>
                <td class="reason">
                    <?php echo $this->escapeHtml($this->getMessage($item))?>
                    <?php if ($explanation = $this->getExplanation($item)):?><br /><small><?php echo $this->escapeHtml($explanation);?></small><?php endif;?>
                </td>
                <td class="date">
                    <span class="nobr"><?php echo $this->getDate($item)?></span>
                    <?php if ($expirationDate = $this->getExpirationDate($item)):?>
                    <small class="nobr"><?php echo $this->__('Expires on %s', $expirationDate);?></small>
                    <?php endif;?>
                </td>
            </tr>
            <?php endforeach; ?>
        </tbody>
    </table>
    <script type="text/javascript">decorateTable('reward-history')</script>

    <?php echo $this->getChildHtml('pager') ?>

    <?php else:?>

    <p><?php echo $this->__('There is no balance history yet.')?></p>

    <?php endif;?>
</div>
